#include <stdio.h>

void shellSort(int* array, int length)
{
    int i, j, flag, gap = length;
    int temp;
    while(gap > 1) {
	gap = gap / 2;
	do {
	    flag = 0;
	    for(i = 0; i < length -  gap; ++i) {
		j = i + gap;
		if(array[i] < array[j]) {
		    temp = array[i];
		    array[i] = array[j];
		    array[j] = temp;
		    flag = 1;
		}
	    }
	} while(flag == 1);
    }
}
